<?php namespace Api\Controller;

class ChargeController extends ApiBaseController{

  /*
   *  获取列表
   */
  public function index(){
     try{
        $list = D("Fare")->where(array('status'=>1))->select();
        if($list){
          $this->ApiReturn(1,'SUCCESS',$list); 
        }else{
          $this->ApiReturn(0,'EMPTY'); 
        }   
     }catch(\Exception $e){
         $this->ApiReturn(-1,L('SYSTEM_ERROR')); 
     }
     
  }

  /*
   *   获取值和数据
   */
  public public function check()
  {
     $data = $this->data;
     if(!$data['id']){
       $this->ApiReturn(-1,L('ID_MUST_GIVEN')); 
     }
     try{
     	$info = D("Fare")
		      ->where(array('id'=>$data['id']))
		      ->find();
	        $this->ApiReturn(1,'SUCCESS',$info);
	    }catch(\Exception $E){
         $this->ApiReturn(-1,L('SYSTEM_ERROR')); 
	   }
  }
  

}

 ?>